//
//  BJBaseViewController.m
//  JuJinHuiRong
//
//  Created by APPLE on 16/11/3.
//  Copyright © 2016年 APPLE. All rights reserved.
//

#import "BJBaseViewController.h"

@interface BJBaseViewController ()

@end

@implementation BJBaseViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    UIImage *image = [[UIImage imageNamed:@"return_h"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:image style:(UIBarButtonItemStyleDone) target:self action:@selector(didClickBackItem:)];
        
    [self initUI];
//    [self setNav];
}

-(UIImage*)createImageWithColor:(UIColor*)color {
    
    CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}

- (void)setNav{
    
        NSDictionary *textAttibuted = @{
                                        NSForegroundColorAttributeName : [UIColor whiteColor],
                                        NSFontAttributeName : FontVlaue(20)
                                        };
        UINavigationBar *navBar = [UINavigationBar appearance];
        [navBar setTitleTextAttributes:textAttibuted];
        navBar.opaque = NO;
        navBar.translucent = YES;
        [navBar setBackgroundImage:[self createImageWithColor:[UIColor whiteColor]] forBarMetrics:UIBarMetricsDefault];
        [navBar setShadowImage:[UIImage new]];
        [[navBar subviews] firstObject].backgroundColor = [UIColor whiteColor];
//    navBar.tintColor = BaseColor;
        UIBarButtonItem *backBarItem = [UIBarButtonItem appearance];
        [backBarItem setTintColor:BlackTextColor];
    self.navigationItem.rightBarButtonItem.tintColor = BaseColor;
}
- (void)didClickBackItem:(UIBarButtonItem *)item{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)initUI{
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end
